package com.example.park_management.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.park_management.common.PageParam;
import com.example.park_management.domain.Maintenance;
import com.example.park_management.domain.vo.MaintenanceResponseVO;
import com.example.park_management.service.MaintenanceService;
import com.example.park_management.mapper.MaintenanceMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xiaoming
 * @description 针对表【maintenance(维护)】的数据库操作Service实现
 * @createDate 2024-05-28 17:04:33
 */
@Service
public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceMapper, Maintenance>
        implements MaintenanceService {

    @Resource
    MaintenanceMapper maintenanceMapper;

    @Override
    public List<MaintenanceResponseVO> pageQuery(PageParam<MaintenanceResponseVO> pageParam) {
        // 计算 limit
        pageParam.setPageNum((pageParam.getPageNum() - 1) * pageParam.getPageSize());
        return maintenanceMapper.pageQuery(pageParam);
    }

    @Override
    public long countQuery(PageParam<MaintenanceResponseVO> pageParam) {
        Long aLong = maintenanceMapper.countQuery(pageParam);
        return aLong != null ? aLong : 0;
    }
}




